from appium import webdriver


class Base:
    def __init__(self):
        cap={
          "platformName": "Android",
          "appium:deviceName": "emulator-5554",
          "appium:automationName": "uiautomator2",
          "appium:appPackage": "com.achievo.vipshop",
          "appium:appActivity": ".homepage.activity.MainActivity",
          "appium:noReset": True
        }
        self.driver=webdriver.Remote('http://127.0.0.1:4723/wd/hub',cap)
    def find_ele(self,ele):
        loc=self.driver.find_element(*ele)
        return loc
    def qingqiao(self,a,b):
        self.driver.tap([(a,b)],200)
    def huadong(self,a,b,c,d):
        self.driver.swipe(a,b,c,d,200)
    def jietu(self):
        self.driver.save_screenshot('tu.png')
    def tuichu(self):
        self.driver.quit()
